﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BeeTest.Samples.FooTests
{
    public class SimpleCalcExample : BehaviorTestBase
    {
        public class Foo
        {
            public Foo parent;

            public static void StaticFooInit() { }
            public Foo() { }
            public Foo(Foo p) { this.parent = p;}
            public void SomeOperation()  { }
            public void InitSomeMember(int i) { }
        }

        [TestMethod]
        public void SomeTest()
        {
            this.Given(Foo.StaticFooInit)
                .And.Returns.Given(FooDefaultConstructed)
                .And.Given(FooMemberWasInitializedWith, 666)
                .And.Returns.Given(FooWithParentConstructed, State<Foo>.Given0)
                .And.Given(FooMemberWasInitializedWith, 777)
                .And.Returns.Given(FooWithParentConstructed, State<Foo, Foo>.Given1)
                .And.Given(FooMemberWasInitializedWith, 888);
        }

        private Foo FooDefaultConstructed()
        {
            return new Foo();
        }

        private Foo FooWithParentConstructed(Foo f)
        {
            return new Foo(f);
        }

        private void FooMemberWasInitializedWith(Foo f, int value)
        {
            f.InitSomeMember(value);
        }
    }
}
